import request from '@/utils/my-request'

export function login(data) {
    return request({
        url: '/api/admins/login',
        method: 'post',
        data
    })
}

export function reg({ adminName, adminPassword }) {
    return request({
        url: '/api/admins/reg',
        method: 'post',
        params: { adminName, adminPassword }
    })
}
export function get({ page, limit }) {
    return request({
        url: "/api/admins/get",
        method: 'get',
        params: { page, limit }
    })
}
export function logout() {
    return request({
        url: '/api/admins/logout',
        method: 'post'
    })
}
export function del(_id) {
    return request({
        url: `/api/admins/del/${_id}`,
        method: 'delete',
    })
}
export function update({ _id, adminName, adminPassword }) {
    return request({
        url: `/api/admins/update/${_id}`,
        method: 'put',
        params: { adminName, adminPassword }
    })
}
export function search(find) {
    return request({
        url: `/api/admins/search`,
        method: 'get',
        params: find
    })
}